<template>
	<div class="conPpageBox">
		<div class="navbar">
			<div class="hearderBoxIcon" @click="goBack">
				<img src="../../assets/images/fanhuijiantou.png" alt="">
			</div>
			<div class="title">{{$t('indexTitle.title228')}}</div>
			<div class="right" @click="goNextPage('/promotion',$t('indexTitle.title105'))">{{$t('indexTitle.title229')}}
			</div>
		</div>
		<div class="info-block">
			<div class="content">
				<div class="row">
					<div class="account">
						<img src="../../assets/images/geren.png" alt="" />
						<span>{{info.name}}</span>
					</div>
					<div class="balance-label">
						<img src="../../assets/images/yue.png" alt="" />
						<span>{{$t('indexTitle.title23')}}</span>
					</div>
				</div>
				<div class="row" style="justify-content: flex-end;">
					<div class="balance-value">{{info.money||0}}</div>
				</div>
			</div>
		</div>
		<div class="deposit-list">
			<div class="item" v-for="(item,index) in type" :key="index"
				:class="[item.type == 1 ? 'item1':'',item.type == 2 ? 'item2':'',item.type == 4 ? 'item4':'']"
				@click="gorecharge(item)">
				<h3>{{item.name}}</h3>
				<div class="mc-collection-description" v-if="item.type == 1">
					{{$t('indexTitle.title291')}}{{$t('indexTitle.title289')}}{{systemconfig.zsk_min||0}}
					{{$t('indexTitle.title290')}}{{systemconfig.zsk_max||0}}
				</div>
				<div class="mc-collection-description" v-if="item.type == 2">
					{{$t('indexTitle.title291')}}{{$t('indexTitle.title289')}}{{systemconfig.bld_min||0}}
					{{$t('indexTitle.title290')}}{{systemconfig.bld_max||0}}
				</div>
				<div class="mc-collection-description" v-if="item.type == 3">
					{{$t('indexTitle.title291')}}{{$t('indexTitle.title289')}}{{systemconfig.usdt_min||0}}
					{{$t('indexTitle.title290')}}{{systemconfig.usdt_max||0}}
				</div>
				<div class="mc-collection-description" v-if="item.type == 4">
					{{$t('indexTitle.title291')}}{{$t('indexTitle.title289')}}{{systemconfig.yh_min||0}}
					{{$t('indexTitle.title290')}}{{systemconfig.yh_max||0}}
				</div>
				<!-- <small>{{item.name}}</small> -->
			</div>
		</div>
		<!-- <div class="buttons">
			<img src="../../assets/images/xiaoxi.png" alt="" />
		</div> -->
		<loadingThree v-if="isShowLoading"></loadingThree>
		<loadingFour :msgText="msgTextTow" v-if="isShowLoadingTeow" @closeGuanbiTow="closeGuanbi"></loadingFour>
	</div>
</template>

<script>
	import {
		userinfo,
		rechargetype,
		getsystemconfig,
	} from "../../utils/api.js"
	import loadingThree from '../../components/loadingThree.vue';
	import loadingFour from '../../components/loadingFour.vue';
	export default {
		data() {
			return {
				info: [],
				type: [],
				isShowLoading: true,
				msgTextTow: "",
				isShowLoadingTeow: false,
				systemconfig: [],
			}
		},
		components: {
			loadingThree,
			loadingFour
		},
		mounted() {
			if (localStorage.getItem("userInfo")) {
				this.info = JSON.parse(localStorage.getItem('userInfo'))
			}
			this.getuserinfo()
			this.getsystem()
			this.getrechargetype()
		},
		methods: {
			closeGuanbi(e) {
				this.isShowLoadingTeow = false;
			},
			getsystem() {
				getsystemconfig().then((res) => {
					if (res.status.errorCode == 0) {
						this.systemconfig = res.data
					} else {
						// this.$message.error(res.status.msg);
						this.msgTextTow = res.status.msg;
						this.isShowLoadingTeow = true;
						this.isShowCloseBot = false;
						setTimeout(() => {
							this.isShowLoadingTeow = false;
						}, 2000)
						// this.$message({
						// 	showClose: true,
						// 	message: res.status.msg,
						// 	type: 'error'
						// });
					}
				}).catch((err) => {
					console.log(err, 'err')
				});
			},
			getuserinfo() {
				userinfo().then((res) => {
					if (res.status.errorCode == 0) {
						localStorage.setItem('userInfo', JSON.stringify(res.data))
						this.info = JSON.parse(localStorage.getItem('userInfo'))
						this.info = res.data
					} else if (res.status.errorCode == 401) {
						console.log('401')
					} else {
						// this.$message.error(res.status.msg);
						this.msgTextTow = res.status.msg;
						this.isShowLoadingTeow = true;
						setTimeout(() => {
							this.isShowLoadingTeow = false;
						}, 2000)
						// this.$message({
						// 	showClose: true,
						// 	message: res.status.msg,
						// 	type: 'error'
						// });
					}
				}).catch((err) => {
					console.log(err, 'err')
				});
			},
			getrechargetype() {
				rechargetype().then((res) => {
					if (res.status.errorCode == 0) {
						this.type = res.data
						this.isShowLoading = false;
					} else {
						// this.$message.error(res.status.msg);
						this.msgTextTow = res.status.msg;
						this.isShowLoadingTeow = true;
						setTimeout(() => {
							this.isShowLoadingTeow = false;
						}, 2000)
						// this.$message({
						// 	showClose: true,
						// 	message: res.status.msg,
						// 	type: 'error'
						// });
					}
				}).catch((err) => {
					console.log(err, 'err')
				});
			},
			gorecharge(e) {
				this.$router.push({
					path: '/Charge',
					query: {
						type: e.type
					}
				})
			},
			goBack() {
				this.$router.go(-1)
			},
			goNextPage(page, title) {
				this.$router.push({
					path: page,
					query: {
						title: title
					}
				});
			}
		}
	}
</script>

<style scoped>
	* {
		box-sizing: border-box;
		margin: 0;
		padding: 0;
	}

	.conPpageBox {
		height: 90vh;
		overflow-y: auto;
		overflow-x: hidden;
		padding-top: calc(constant(safe-area-inset-top) + 0px);
		padding-top: calc(env(safe-area-inset-top) + 0px);
		padding-bottom: calc(constant(safe-area-inset-bottom) + 85px);
		padding-bottom: calc(env(safe-area-inset-bottom) + 85px);
		box-sizing: border-box;
		position: fixed;
		z-index: 1;
		-webkit-overflow-scrolling: touch;
		width: 100%;
	}

	.navbar {
		background-color: #fff;
		box-shadow: inset 0 -1px 0 #ececec;
		color: #545658;
		height: 45px;
		left: 0;
		overflow: hidden;
		display: flex;
		justify-content: space-between;
		align-items: center;
		position: fixed;
		padding: 0 10px;
		top: 0;
		width: 100%;
		z-index: 99;
	}

	.hearderBoxIcon {
		flex: .25;
		line-height: 1;
	}
	.mc-collection-description {
		color: #939698;
		font-size: 10px;
		line-height: 14px;
	}

	.hearderBoxIcon img {
		width: 26px;
		height: 26px;
	}

	.title {
		flex: 1;
		font-size: 20px;
		line-height: 1;
		text-align: center;
	}

	.right {
		flex: .25;
		line-height: 1;
		font-size: 13px;
	}

	.info-block {
		background-color: #fbfbfb;
		border-bottom-left-radius: 110px 45px;
		border-bottom-right-radius: 110px 45px;
		width: 100%;
		margin-top: 45px;
	}

	.content {
		background: linear-gradient(135deg, #7240ff, #7240ff 45%, #895fff 0, #7240ff);
		padding: 10px 15px 10px 0;
		position: relative;
		z-index: 1;
	}

	.row {
		color: #fff;
		display: flex;
		justify-content: space-between;
	}

	.account {
		align-items: center;
		display: flex;
		font-size: 14px;
		background-color: #4c0dff;
		border-radius: 0 100px 100px 0;
		height: 30px;
		padding: 3px 15px;
	}

	.account img {
		width: 20px;
		height: 20px;
		margin-right: 3px;
	}

	.balance-label {
		align-items: center;
		display: flex;
		font-size: 14px;
	}

	.balance-label img {
		width: 20px;
		height: 20px;
		margin-right: 3px;
	}

	.balance-value {
		font-size: 24px;
		line-height: 31px;
		font-weight: 600;
	}

	.deposit-list {
		padding: 5px 0 20px;
		background-color: #fff;
	}

	.item {
		background: #fafafc;
		border: 1px solid #ececec;
		border-radius: 5px;
		display: flex;
		flex-direction: column;
		font-size: 12px;
		justify-content: center;
		margin: 10px 15px 0;
		min-height: 66px;
		padding: 5px 10px 5px 60px;
		position: relative;
		word-break: break-word;
	}

	.item::before {
		background: url('../../assets/images/usdt.webp') 50%/contain no-repeat;
		content: " ";
		font-family: iconmps !important;
		font-size: 35px;
		height: 36px;
		left: 10px;
		position: absolute;
		text-align: center;
		top: 50%;
		transform: translateY(-50%);
		width: 40px;
	}

	.item1::before {
		background: url('../../assets/images/zsk.webp') 50%/contain no-repeat;
		content: " ";
		font-family: iconmps !important;
		font-size: 35px;
		height: 36px;
		left: 10px;
		position: absolute;
		text-align: center;
		top: 50%;
		transform: translateY(-50%);
		width: 40px;
	}

	.item2::before {
		background: url('../../assets/images/bld.png') 50%/contain no-repeat;
		content: " ";
		font-family: iconmps !important;
		font-size: 35px;
		height: 36px;
		left: 10px;
		position: absolute;
		text-align: center;
		top: 50%;
		transform: translateY(-50%);
		width: 40px;
	}

	.item4:before {
		background: url('../../assets/images/yinhangzhanghu.png') 50%/contain no-repeat;
		content: " ";
		font-family: iconmps !important;
		font-size: 35px;
		height: 36px;
		left: 10px;
		position: absolute;
		text-align: center;
		top: 50%;
		transform: translateY(-50%);
		width: 40px;
	}

	h3 {
		color: #545658;
		font-size: 15px;
		font-weight: 400;
		margin-bottom: 5px;
	}

	small {
		color: #939698;
		font-size: 11px;
		font-weight: 300;
		letter-spacing: 1px;
		line-height: 14px;
		text-transform: uppercase;
	}

	.buttons {
		position: fixed;
		bottom: 10%;
		right: 10px;
		background-color: #99D2E3;
		width: 60px;
		height: 60px;
		border-radius: 50%;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.buttons img {
		width: 32px;
		height: 32px;
	}
</style>